﻿using dd.Tasks;
using dd.Tasks.Dtos;
using dd.Web.Models.Tasks;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace dd.Web.Controllers
{
	public class TasksController : ddControllerBase
	{
		private readonly ITaskAppService _taskAppService;

		public TasksController(ITaskAppService taskAppService)
		{
			_taskAppService = taskAppService;
		}

		public async Task<ActionResult> Index(GetAllTasksInput input)
		{
			var output = await _taskAppService.GetAll(input);
			var model = new IndexViewModel(output.Items);
			return View(model);
		}
	}
}
